To apply a texture onto a surface properly, the FS viewer needs to know for any triangle of the surface and for any vertex of the triangle its exact position with respect to the texture. Assigning a pixel to every vertex would drive you nuts very quickly. The intent of the texture support is to help you in that process. Let us take an example: cast the MYTEXTURE texture onto the sub-assy MYSUB. To do that, we shall answer three questions:
AD2K2 gives us 6 different options :
The right option means that the left part of the texture applies on the aft part of the model in a side view and that the right part of the texture applies on the fore part of the model in a side view. The left option means the opposite (the left part of the texture applies on the fore part of the model in a side view and the right part of the texture applies on the aft part of the model in a side view).
The top option means that the left part of the texture applies on the left part of the model in a top view and that the right part of the texture applies on the right part of the model in a top view. The bottom option means the opposite.
The fore option means that the left part of the texture applies on the right part of the model in a front view (looking at the model from the front, you see its right wing on your left, don't you?) and that the right part of the texture applies on the left part of the model in a front view. The aft option means the opposite.
Unless you want it, the texture does not fit exactly the sub-assy dimensions. Sometimes, the same texture file is used with several sub-assies. In some other cases, the texture comprises several views of the same sub-assy: the right view and the left one, for instance. It means that the texture would virtually encompass a larger thing than the sub-assy. Let us suppose that MYSUB is a wheel. We are considering the application of a part of MYTEXTURE on it from the right. As you can see, the wheel picture occupies the left/top part of the texture. It is just one fourth of it (one half of the width, one half of the height).
Mapping the texture on a virtual area in order to fit the exact location of the wheel is uneasy. The texture support and texture limits concept makes things easier.
Let us suppose that the wheel extremities in the side view are the following:
ymin = -2.400
ymax = -0.200
zmin = -4.000
zmax = -1.800
The texture support is a polygon the extremies of which coincide with these numbers. This polygon may be a square or any other kind of polygon. Let us define a hidden triangle with the following vertices:
x = 0.000, y = -2.400, z = -4.000
x = 0.000, y = -0.200, z = -4.000
x = 0.000, y = -1.000, z = -1.800
The min y coordinate is -2.400, the max y coordinate is 0.200, the min z coordinate is -4.000, the max z coordinate is -1.800: it is a good candidate for the job!
As we saw before, the image to be casted on the wheel is in the left/top part of the texture. Let us talk about numbers. The position of a pixel in the texture may be represented by two numbers:
First step: declare a texture support
Use the Graphic Editor to create the triangle with the following vertices:
Second step: assign the MYTEXTURE texture to the MYSUB sub-assy
Select the MYSUB sub-assy in the sub-assy panel. Open the sub-assy code window
by clicking on the open instruction window button
of the sub-assy panel tool-bar. Click on the select a texture
button of the sub-assy code window tool-bar. Select the MYTEXTURE texture in the
texture selection window. If it is not available in the list, click on the open
button to find it. Validate to go back to the sub-assy code window.
Tip: It is recommended to have all the texture files inside the project directory. If one is missing, you will not be able to assign it texture limits. |
To get information on the options available in the sub-panel which is below the texture list, please refer to the section of this tutorial dedicated to the
texture allocation system used by FS.
Third step: assign the texture support In the sub-assy code window, the first instruction in the list is a LIMITS instruction. It is assigned an undefined texture support. Double-click on the instruction. The texture support selection window is displayed. To the right of the window, there is a small sub-panel with two arrows: one is pointing to the left, the other one to the right. Click on one of the arrows. As you have declared the required texture support just before, it is loaded at once. The texture support extremities are displayed below the pair of arrows. Make sure you have selected the side option.
Tip: The same texture support can be used with several sub-assies. To load it if it is not available at the first click on an arrow, click again. |
Fourth step: assign the limits within the texture
If the texture file is in the project directory, it is displayed to the left of the window. The default limits are
Tip: Selecting a wrong direction in the texture support selection window (right instead of left, top instead of lower, fore instead of aft...) results in a reversed image. |
To initialize the process, draw a chain which encompass the wing in the top view, give it the hidden attribute and declare it as a texture support. Open the sub-assy code window and assign the WINGTEX file to the sub-assy. Double-click on the first instruction which is a LIMITS instruction. In the texture selection window, click on the top radio button and load the appropriate texture support.
We shall start with the top view. Click on the limits button and select the upper-half area:
This applies the upper view on top of the wing and underneath it. That is not what we want. Go back to the Graphic Editor. Select the MYWING sub-assy. Activate the multiple selection mode by clicking on the multiple selection button in the tool-bar. Use the C key and the space key of the keyboard to select all the triangles of the lower face of the wing. Keep the multiple selection mode activated and open the MYWING sub-assy code window. You can see that a lot of TRIANGLE instructions are selected. These are the triangles that you have just selected before. Click on the arrow pointing to the bottom in the tool-bar (move at bottom). All the selected instructions are gathered at the bottom of the list.
Cool, isn't it? Click now on the first selected instruction. It is now the only
one. Click on the insert a texture limit instruction
button in the tool-bar: a new LIMITS instruction is inserted with an undefined texture limit. Double-click
on it to open the texture support selection window. In the texture support selection window check
the top radio button and load the texture support that we already used to define the upper
view.
To assign the lower part of the texture, click on the limits button. Select the lower-half of the image:
Let us summarize. The first LIMITS instruction assigns the upper-half of the texture to the triangles immediately following it. As we gathered the triangles of the lower face of the wing at the end of the list, the triangles on top of the list are the triangles of the upper face. Then the second LIMITS instruction assigns the lower-half of the texture to the triangles at the end of the list... which are the triangles of the lower face. This is it!